package com.yunsc.media.utils;

import com.yunsc.media.entity.YunscUploadFileEntity;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-04-17 23:45
 */
public class FormatUploadFile {

    // 格式化文件信息
    public static YunscUploadFileEntity formatFile(YunscUploadFileEntity file) {
        Integer fileType = file.getFileType();
        if (fileType == 30){
            file.setPreviewUrl("https://mytake.oss-cn-guangzhou.aliyuncs.com/video-file.png");
        } else if (fileType == 20) {
            file.setPreviewUrl("https://mytake.oss-cn-guangzhou.aliyuncs.com/annex-flie.png");
        }else {
            // file.setPreviewUrl("http://8.134.205.222:8001/uploads/" + file.getFilePath());
            file.setPreviewUrl(file.getDomain() +"/"+file.getBucket() + "/" + file.getFilePath());
        }
        // file.setExternalUrl("http://8.134.205.222:8001/uploads/" + file.getFilePath());
        file.setExternalUrl(file.getDomain() +"/"+file.getBucket() + "/" + file.getFilePath());
        return file;
    }
}
